package org.budo.support.mybatis.session.wrapper;

import java.sql.Connection;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.cursor.Cursor;
import org.apache.ibatis.executor.BatchResult;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;

/**
 * @author limingwei2
 */
@SuppressWarnings("rawtypes")
public class SqlSessionWrapper implements SqlSession {
    private SqlSession sqlSession;

    public SqlSessionWrapper(SqlSession sqlSession) {
        this.sqlSession = sqlSession;
    }

    public SqlSession getSqlSession() {
        return sqlSession;
    }

    public <T> T selectOne(String statement) {
        return this.getSqlSession().selectOne(statement);
    }

    public <T> T selectOne(String statement, Object parameter) {
        return this.getSqlSession().selectOne(statement, parameter);
    }

    public <E> List<E> selectList(String statement) {
        return this.getSqlSession().selectList(statement);
    }

    public <E> List<E> selectList(String statement, Object parameter) {
        return this.getSqlSession().selectList(statement, parameter);
    }

    public <E> List<E> selectList(String statement, Object parameter, RowBounds rowBounds) {
        return this.getSqlSession().selectList(statement, parameter, rowBounds);
    }

    public <K, V> Map<K, V> selectMap(String statement, String mapKey) {
        return this.getSqlSession().selectMap(statement, mapKey);
    }

    public <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey) {
        return this.getSqlSession().selectMap(statement, parameter, mapKey);
    }

    public <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowBounds) {
        return this.getSqlSession().selectMap(statement, parameter, mapKey, rowBounds);
    }

    public <T> Cursor<T> selectCursor(String statement) {
        return this.getSqlSession().selectCursor(statement);
    }

    public <T> Cursor<T> selectCursor(String statement, Object parameter) {
        return this.getSqlSession().selectCursor(statement, parameter);
    }

    public <T> Cursor<T> selectCursor(String statement, Object parameter, RowBounds rowBounds) {
        return this.getSqlSession().selectCursor(statement, parameter, rowBounds);
    }

    public void select(String statement, Object parameter, ResultHandler handler) {
        this.getSqlSession().select(statement, parameter, handler);
    }

    public void select(String statement, ResultHandler handler) {
        this.getSqlSession().select(statement, handler);
    }

    public void select(String statement, Object parameter, RowBounds rowBounds, ResultHandler handler) {
        this.getSqlSession().select(statement, parameter, rowBounds, handler);
    }

    public int insert(String statement) {
        return this.getSqlSession().insert(statement);
    }

    public int insert(String statement, Object parameter) {
        return this.getSqlSession().insert(statement, parameter);
    }

    public int update(String statement) {
        return this.getSqlSession().update(statement);
    }

    public int update(String statement, Object parameter) {
        return this.getSqlSession().update(statement, parameter);
    }

    public int delete(String statement) {
        return this.getSqlSession().delete(statement);
    }

    public int delete(String statement, Object parameter) {
        return this.getSqlSession().delete(statement, parameter);
    }

    public void commit() {
        this.getSqlSession().commit();
    }

    public void commit(boolean force) {
        this.getSqlSession().commit(force);
    }

    public void rollback() {
        this.getSqlSession().rollback();
    }

    public void rollback(boolean force) {
        this.getSqlSession().rollback(force);
    }

    public List<BatchResult> flushStatements() {
        return this.getSqlSession().flushStatements();
    }

    public void close() {
        this.getSqlSession().close();
    }

    public void clearCache() {
        this.getSqlSession().clearCache();
    }

    public Configuration getConfiguration() {
        return this.getSqlSession().getConfiguration();
    }

    public <T> T getMapper(Class<T> type) {
        return this.getSqlSession().getMapper(type);
    }

    public Connection getConnection() {
        return this.getSqlSession().getConnection();
    }
}